<?php

namespace common\validate;


class Settlement extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }


    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append("param", 'require|array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data.name', 'require|max:128')
            ->append('data.code', 'max:128');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data.id', 'require')
            ->append('data.name', 'max:128')
            ->append('data.code', 'max:128');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }


    // AddSettlement 验证场景定义
    public function sceneAddSettlement()
    {
        return $this->append("data.order_id", 'require|integer')
            ->append("data.money", 'require')
            ->append("data.person_in_charge", 'integer')
            ->append("data.project_id", 'integer')
            ->append("data.contract_id", 'integer')
            ->append("data.remark", 'max:4096');
    }
}
